<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>登录 - 教师测评系统</title>
    <!-- Bootstrap 5 CSS -->
    <link th:href="@{/static/css/bootstrap.min.css}" rel="stylesheet">
    <!-- Bootstrap Icons -->
    <link th:href="@{/static/css/bootstrap-icons.css}" rel="stylesheet">
    <!-- 引入Google Fonts -->
    <style>
    :root {
      --primary-color: #3f6ad8;
      --primary-gradient: linear-gradient(135deg, #3f6ad8 0%, #2952bb 100%);
      --secondary-color: #6c757d;
      --background-color: #f8f9fe;
      --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
      --text-color: #495057;
      --text-muted: #8a94a6;
      --border-radius: 16px;
    }

    body {
      font-family: 'Noto Sans SC', 'Poppins', sans-serif;
      background: var(--background-color);
      background-image:
        radial-gradient(circle at 10% 20%, rgba(63, 106, 216, 0.05) 0%, transparent 25%),
        radial-gradient(circle at 90% 80%, rgba(63, 106, 216, 0.05) 0%, transparent 25%);
      display: flex;
      flex-direction: column;
      min-height: 100vh;
      position: relative;
      overflow-x: hidden;
      color: var(--text-color);
    }

    /* 装饰效果 */
    .decoration {
      position: absolute;
      border-radius: 50%;
      z-index: -1;
    }

    .decoration-1 {
      top: -120px;
      right: -80px;
      width: 280px;
      height: 280px;
      background: linear-gradient(135deg, rgba(63, 106, 216, 0.12) 0%, rgba(41, 82, 187, 0.05) 100%);
    }

    .decoration-2 {
      bottom: -150px;
      left: -100px;
      width: 320px;
      height: 320px;
      background: linear-gradient(135deg, rgba(63, 106, 216, 0.08) 0%, rgba(41, 82, 187, 0.03) 100%);
    }

    .decoration-3 {
      top: 40%;
      left: 10%;
      width: 80px;
      height: 80px;
      background: linear-gradient(135deg, rgba(63, 106, 216, 0.1) 0%, rgba(41, 82, 187, 0.05) 100%);
    }

    .decoration-4 {
      top: 25%;
      right: 15%;
      width: 60px;
      height: 60px;
      background: linear-gradient(135deg, rgba(63, 106, 216, 0.06) 0%, rgba(41, 82, 187, 0.03) 100%);
    }

    .login-container {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 30px 20px;
      position: relative;
      z-index: 2;
    }

    .login-brand {
      margin-bottom: 50px;
      text-align: center;
    }

    .login-logo {
      font-size: 36px;
      color: var(--primary-color);
      margin-bottom: 15px;
      display: inline-block;
      background: var(--primary-gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      border: 2px solid var(--primary-color);
      width: 80px;
      height: 80px;
      line-height: 76px;
      border-radius: 50%;
      box-shadow: 0 5px 15px rgba(63, 106, 216, 0.2);
    }

    .login-title {
      font-size: 28px;
      font-weight: 700;
      margin-bottom: 10px;
      color: #2c3e50;
      letter-spacing: 1px;
    }

    .login-subtitle {
      font-size: 16px;
      color: var(--text-muted);
      margin-bottom: 0;
    }

    .login-card {
      width: 100%;
      max-width: 430px;
      background-color: #fff;
      border-radius: var(--border-radius);
      box-shadow: var(--card-shadow);
      padding: 40px 35px;
      transition: all 0.4s ease;
      position: relative;
      border: 1px solid rgba(230, 235, 250, 0.9);
    }

    .login-card:hover {
      transform: translateY(-8px);
      box-shadow: 0 15px 35px rgba(63, 106, 216, 0.12);
    }

    .login-header {
      text-align: center;
      margin-bottom: 30px;
    }

    .login-header h2 {
      font-size: 22px;
      font-weight: 600;
      color: #2c3e50;
      margin-bottom: 12px;
    }

    .login-header p {
      color: var(--text-muted);
      font-size: 14px;
      margin-bottom: 0;
    }

    .form-group {
      margin-bottom: 25px;
      position: relative;
    }

    .form-label {
      font-weight: 500;
      color: #495057;
      margin-bottom: 8px;
    }

    .form-control {
      height: 54px;
      border-radius: 12px;
      border: 2px solid #e9ecef;
      padding: 10px 15px 10px 48px;
      font-size: 16px;
      transition: all 0.3s;
      background-color: #f8f9fa;
    }

    .form-control:focus {
      border-color: var(--primary-color);
      box-shadow: 0 0 0 0.25rem rgba(63, 106, 216, 0.15);
      background-color: #fff;
    }

    .input-icon {
      position: absolute;
      top: 50%;
      left: 16px;
      transform: translateY(-50%);
      color: var(--text-muted);
      font-size: 18px;
    }

    .btn-login {
      height: 54px;
      border-radius: 12px;
      background: var(--primary-gradient);
      border: none;
      font-size: 16px;
      font-weight: 600;
      margin-top: 10px;
      transition: all 0.3s;
      box-shadow: 0 5px 15px rgba(63, 106, 216, 0.2);
      position: relative;
      overflow: hidden;
    }

    .btn-login:before {
      content: '';
      position: absolute;
      top: 0;
      left: -100%;
      width: 100%;
      height: 100%;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
      transition: all 0.6s;
    }

    .btn-login:hover {
      transform: translateY(-3px);
      box-shadow: 0 8px 20px rgba(63, 106, 216, 0.25);
    }

    .btn-login:hover:before {
      left: 100%;
    }

    .btn-login:active {
      transform: translateY(-1px);
    }

    .login-footer {
      text-align: center;
      color: var(--text-muted);
      font-size: 14px;
      margin-top: 40px;
      font-weight: 300;
    }

    /* 响应式调整 */
    @media (max-width: 576px) {
      .login-title {
        font-size: 24px;
      }
      .login-card {
        padding: 30px 25px;
      }
      .login-logo {
        font-size: 32px;
        width: 70px;
        height: 70px;
        line-height: 66px;
      }
    }
    </style>
</head>
<body>
<!-- 装饰元素 -->
<div class="decoration decoration-1"></div>
<div class="decoration decoration-2"></div>
<div class="decoration decoration-3"></div>
<div class="decoration decoration-4"></div>

<div class="login-container">
    <div class="login-brand">
        <div class="login-logo">
            <i class="bi bi-mortarboard-fill"></i>
        </div>
        <h1 class="login-title">教师测评系统</h1>
        <p class="login-subtitle">专业的教师评价与成长平台</p>
    </div>

    <div class="login-card">
        <div class="login-header">
            <h2>欢迎登录</h2>
            <p>请输入您的账号和密码</p>
        </div>

        <form id="loginForm">
            <div class="form-group">
                <i class="bi bi-person-fill input-icon"></i>
                <input type="text" class="form-control" id="username" name="username" placeholder="用户名" required>
            </div>

            <div class="form-group mb-4">
                <i class="bi bi-lock-fill input-icon"></i>
                <input type="password" class="form-control" id="password" name="password" placeholder="密码" required>
            </div>

            <button type="button" class="btn btn-primary w-100 btn-login" id="loginBtn">
                <i class="bi bi-box-arrow-in-right me-2"></i>登录系统
            </button>
        </form>
    </div>

    <div class="login-footer">
        <i class="bi bi-shield-check me-1"></i> © 2023 教师测评系统 版权所有
    </div>
</div>

<!-- jQuery -->
<script th:src="@{/static/js/jquery-3.6.0.min.js}"></script>
<!-- Bootstrap JS -->
<script th:src="@{/static/js/bootstrap.bundle.min.js}"></script>

<script>
    $(document).ready(function() {
      $('#loginBtn').click(function() {
        const username = $('#username').val();
        const password = $('#password').val();

        if (!username || !password) {
          alert('请输入用户名和密码');
          return;
        }

        // 简化处理，实际应调用后端API
        $.ajax({
          url: '/api/user/login',
          method: 'POST',
          contentType: 'application/json',
          data: JSON.stringify({
            username: username,
            password: password
          }),
          success: function(resp) {
            if (resp.code === 200) {
              // 保存token
              localStorage.setItem('token', resp.data.token);
              // 跳转到首页
              window.location.href = '/h5/index';
            } else {
              alert('登录失败：' + resp.message);
            }
          },
          error: function() {
            alert('登录失败，请稍后再试');
          }
        });
      });

      // 按下Enter键也能登录
      $('#password').keypress(function(e) {
        if(e.which == 13) {
          $('#loginBtn').click();
        }
      });
    });
</script>
</body>
</html>
